package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class FabricaConexoesBanco {

	private static String driver = "com.mysql.jdbc.Driver";
	private static String url = "jdbc:mysql://localhost/siscop";
	private static String user = "root";
	private static String pwd = "12345";
	private static FabricaConexoesBanco fabrica;
	private static Connection conexao;

	private FabricaConexoesBanco(){
		try {
			Class.forName(driver);

			conexao = DriverManager.getConnection(url, user, pwd);

		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}
	
	public static FabricaConexoesBanco getInstancia() {
		if (fabrica == null) {
			fabrica = new FabricaConexoesBanco();
		}
		return fabrica;
	}

	public Connection getConexao() {
		return conexao;
	}

}
